import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;

public class DaYingLiuDemo {
    public static void main(String[] args) {
        try(PrintStream printStream = new PrintStream(new File("E:\\IO流练习\\字符流\\FileWrite\\2.txt"))){
            printStream.printf("余票还有%d",12 );
            System.setOut(printStream);
            System.out.println("今天天气不错！");
            System.out.println();
            System.out.printf("余票还有%d", 12);
            System.out.println();
            System.out.print("123");
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        System.out.println("hello");
        System.err.println("hello");
    }
}
